dnl --------------------------------
dnl Initialization macros.
dnl --------------------------------

AC_INIT(src/swacd.cc)
AM_CONFIG_HEADER(config.h)

dnl -----------------------------------------------
dnl Package name and version number (user defined)
dnl -----------------------------------------------

AM_INIT_AUTOMAKE(swacd,0.1)

dnl -----------------------------------------------
dnl Checks for programs.
dnl -----------------------------------------------

AC_PROG_CC
AC_PROG_CXX
AM_PROG_LIBTOOL
AM_SANITY_CHECK

dnl -----------------------------------------------
dnl Checks for libraries.
dnl -----------------------------------------------

# Ask user for path to libpq-fe.h
AC_ARG_WITH(psql,
    [  --with-psql=DIR	path to libpq-fe.h (/usr/include/postgresql)],
    [PSQL_INCLUDE=$with_psql],
    AC_MSG_ERROR([You must call configure with the --with-psql option.
    This tells configure where to find the psql C headers.
    e.g. --with-psql=/usr/include/postgresql])
)
PSQL_CFLAGS="-I${PSQL_INCLUDE}"
PSQL_LIBS="-lpq"
AC_SUBST(PSQL_CFLAGS)
AC_SUBST(PSQL_LIBS)

# Check gLib
PKG_CHECK_MODULES(GLIB, [gthread-2.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

dnl -----------------------------------------------
dnl Generates Makefiles.
dnl -----------------------------------------------

AC_OUTPUT(Makefile \
          src/Makefile
)

